package Action

import (
	"fmt"
	"github.com/go-redis/redis"
	"github.com/syyongx/php2go"
	"hello/wl"
	"time"
)

func WriteAjaxCount(redisCli *redis.Client)  {

		count,_:=redisCli.Get("ajax_count").Result()


		if php2go.Empty(count){
			err:=redisCli.Set("ajax_count",1, 60*60*time.Second).Err()

			if err != nil {
				//panic(err)
				fmt.Println(err)
			}
		}else{
			countInt:=wl.ToInt(count)

			countInt++

			err:=redisCli.Set("ajax_count",countInt, 0).Err()

			if err != nil {
				//panic(err)
				fmt.Println(err)
			}
		}

}